#include <bits/stdc++.h>
#define re register
#define fst first
#define snd second
#define int long long
#define Add(a,b) (((a) + (b)) % mod)
#define Sub(a,b) (((a) - (b) + mod) % mod)
#define Mul(a,b) ((a) * (b) % mod)
#define chAdd(a,b) (a = Add(a,b))
#define chMul(a,b) (a = Mul(a,b))

using namespace std;

typedef pair<int,int> pii;
const int N = 1e6 + 10;
const int mod = 1e9 + 7;
int n,m,ans;
int arr[N],tmp[N],sum[N];
int pw[N],fac[N],infac[N];
bool st[N];

inline int read(){
    int r = 0,w = 1;
    char c = getchar();
    while (c < '0' || c > '9'){
        if (c == '-') w = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9'){
        r = (r << 1) + (r << 3) + (c ^ 48);
        c = getchar();
    }
    return r * w;
}

inline int qmi(int a,int b){
    int res = 1;
    while (b){
        if (b & 1) chMul(res,a);
        chMul(a,a); b >>= 1;
    } return res;
}

inline void init(int n){
    pw[0] = fac[0] = 1;
    for (re int i = 1;i <= n;i++){
        pw[i] = Mul(pw[i - 1],2);
        fac[i] = Mul(fac[i - 1],i);
    } infac[n] = qmi(fac[n],mod - 2);
    for (re int i = n - 1;~i;i--) infac[i] = Mul(infac[i + 1],i + 1);
}

inline int A(int n,int m){
    if (n < m) return 0;
    else return Mul(fac[n],infac[n - m]);
}

inline int C(int n,int m){
    if (n < m) return 0;
    else return Mul(fac[n],Mul(infac[n - m],infac[m]));
}

inline void dfs(int u,set<pii> st){
    if (u == m + 1){
        for (pii p:st) chAdd(ans,p.snd);
        // for (pii p:st) cerr << p.snd << " "; cerr << "\n=======\n";
        return;
    }
    for (auto it = st.begin();it != prev(st.end());it++){
        int x,y,xx,yy;
        auto jt = next(it);
        set<pii> tmp = st;
        tie(x,y) = *it; tie(xx,yy) = *jt;
        tmp.erase({x,y}); tmp.erase({xx,yy});
        tmp.insert({x,Sub(y,yy)}); dfs(u + 1,tmp);
    }
}

signed main(){
    freopen("game.in","r",stdin);
    freopen("game.out","w",stdout);
    n = read(),m = read(); init(n);
    set<pii> tmp;
    for (re int i = 1;i <= n;i++) tmp.insert({i,arr[i] = read()});
    dfs(1,tmp);
    // cerr << ans << " ans\n";
    printf("%lld",Mul(ans,qmi(A(n - 1,m),mod - 2)));
    return 0;
}